Slight confusion of `this` in a JavaScript call back function

Posted by thecoshman on Stack Overflow See other posts from Stack Overflow or by thecoshman
Published on 2010-04-29T13:48:49Z Indexed on 2010/04/29 13:57 UTC
Read the original article Hit count: 244

$.ajax({url: path_to_file, cache: false, success: function(html_result){
    $("#window_" + this.id + "_cont_buffer").html(html_result);})

Now then. This function call is with in a function of a class. this.id is a property of said class. will this pass the function value of this.id into the string the anonymous function, or will it try to evaluate it when the function actually gets called, thus making no sense.

If this is not going to work how I want it to, can you recommend how I achieve this.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery